package com.xinchuang.utils;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.xinchuang.domain.entity.TestModelSubTable;
import com.xinchuang.domain.entity.TestNoticeMainTabale;

/**
 * TODO
 *
 * @author zkwczx
 * @version 1.0
 * @date 2023/11/28 16:37
 */
public class EdtionUtil {

    public static JSONObject createNoticeEdtion(TestModelSubTable subTable, TestNoticeMainTabale mainTabale, String tn) {
        JSONObject json = new JSONObject();
        json.put("模具编号", MyUtils.getString(subTable.getMoldId()));
        json.put("模具名称", MyUtils.getString(subTable.getMoldName()));
        json.put("模具外形", MyUtils.getString(subTable.getMoldLook()));
        json.put("几点浇注", MyUtils.getString(subTable.getPourTime()));
        json.put("几点温控（注明接口）", MyUtils.getString(subTable.getTemperatureControlTime()));
        json.put("是否需要液压工作站", MyUtils.getString(subTable.getNeedHydraumaticStation()));
        json.put("几点顺序注塑", MyUtils.getString(subTable.getInjectionMoldingTime()));
        json.put("是否有限位开关", MyUtils.getString(subTable.getHasLimitSwitch()));
        json.put("热点偶型号", MyUtils.getString(subTable.getHotSpotPairType()));
        json.put("是否有时间继电器", MyUtils.getString(subTable.getHasTimeRelay()));
        json.put("制件材料", MyUtils.getString(subTable.getMaterials()));
        json.put("试模件数", MyUtils.getString(subTable.getMoldCount()));
        json.put("制件颜色", MyUtils.getString(subTable.getColor()));
        json.put("材料重量", MyUtils.getString(subTable.getMaterialsCount()));
        json.put("样件重量", MyUtils.getString(subTable.getSamplePieceWeight()));
        json.put("模具重量", MyUtils.getString(subTable.getMoldWeight()));
        json.put("钳工组长", tn);
        json.put("试模次数", "T" + MyUtils.getString(subTable.getTryOutTimes()));
        json.put("计划试模时间", null == subTable.getPlannedTime() ? "" : DateUtil.format(subTable.getPlannedTime(), "yyyy-MM-dd"));
        json.put("版本", MyUtils.getString(mainTabale.getVersionId()));
        json.put("通知单名称",  MyUtils.getString(mainTabale.getNoteName()));
        json.put("编号",  MyUtils.getString(mainTabale.getSerialNumber()));
        json.put("试模目的",  MyUtils.getString(mainTabale.getTargetId()));
        json.put("试模原因",  MyUtils.getString(mainTabale.getTryOutReasonId()));
        json.put("试模注意事项",  MyUtils.getString(mainTabale.getAnnouncements()));
        json.put("副试模目的",  MyUtils.getString(mainTabale.getSubTarget()));
        json.put("试模设备",  MyUtils.getString(mainTabale.getTryOutDeviceId()));
        return json;
    }

}
